import shelve
from python_baway.common.xcommon import sep, xcheck

d = shelve.open('ppt6_page19.tmp.dat')
xcheck(d)
for k in d:
    print(f'{d[k]!r}')

# d['zhang_san'] = {'name': '张三', 'sex': '男', 'age': 38, 'score': 100}
# d['li_si'] = {'name': '李四', 'sex': 'Male', 'age': 22, 'score': 98}
# d['wang_wu'] = {'name': '王 Shuangcong', 'sex': '女', 'age': 35, 'score': 95}
for k in d:
    dt = d[k].copy()
    dt['age'] += 1
    d[k] = dt

sep('After writing')
for k in d:
    print(f'{d[k]!r}')
d.close()
